package model.effects;

import model.entity.Entity;
import model.mediators.DeathMediator;

public class Kill extends Effect {
	private int baseChance;
	private boolean didEffect;
	
	public Kill(int baseChance){
		this.baseChance = baseChance;
	}
	@Override
	public void modifyParameter(double modification) {
		double temp = modification * baseChance;
		baseChance = (int) temp;
		didEffect = false;
	}

	@Override
	public void doEffect(Entity e) {
		if(100*Math.random() <= baseChance){
			e.deathHandler();
			this.didEffect = true;
		}
	}
	@Override
	public String toString(double factor) {		
		double didEffect = this.didEffect ? 1 : 0;
		didEffect += (.01 * factor);
		
		return didEffect > .5 ? "was killed :(." : "was not killed :(.";
	}
}
